<?php 
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
defined('_JEXEC') or die('Restricted access'); 
JHTML::_('behavior.tooltip');
?>
<form action="index.php" method="POST" name="adminForm">
    <div id="editcell">
    <fieldset class="adminform">
		<?php echo $this->getFeedTabs();?>
	</fieldset>	
	<fieldset>
        <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
            <thead>
                <tr>
                    <th width="3%">#</th>
                    <th width="3%"><input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $this->items ); ?>);" /></th>
                    <th width="20%" align="left" nowrap="nowrap"><?php echo JText::_( 'Name' ); ?></th>
                    <th width="30%" align="center" nowrap="nowrap"><?php echo JText::_( 'Description' ); ?></th>
                    <th width="20%" align="left" nowrap="nowrap"><?php echo JText::_( 'Feed Type' ); ?></th>
                    <th width="5%" align="left" nowrap="nowrap"><?php echo JText::_( 'Action' ); ?></th>
                    <th width="5%" nowrap="nowrap"><?php echo JText::_( 'Published' ); ?></th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <td colspan="9">
                        <?php echo $this->pagination->getListFooter(); ?>
                    </td>
                </tr>
            </tfoot>
            <?php
            $k = 0;
            for ($i=0, $n=count( $this->items ); $i < $n; $i++) {
                $row = &$this->items[$i];

                $checked 	= JHTML::_('grid.id',  $i, $row->id );
                $published 	= JHTML::_('grid.published', $row, $i );
				$str_filter = '';
				$str_filter .= "&type=$row->feed_type";
				$str_filter .= "&name=$row->feed_name";
				if (($row->msg_count!=0)&&($row->msg_count!=null))
					$str_filter .= "&job_number=$row->msg_count";
				$str_filter .= "&cache=$row->feed_cache";
				$str_filter .= "&description=$row->feed_description";
				$str_filter .= "&order_by=$row->msg_orderby";
				$str_filter .= "&html=$row->feed_renderHTML";
				$str_filter .= "&image=$row->feed_renderImages";
				if (($row->filter_cat_id!='')&&($row->filter_cat_id!=null))
				{
					$db = JFactory::getDBO();
					$query = "SELECT  name FROM #__ja_categories WHERE id IN ($row->filter_cat_id)";
					$db->setQuery($query);
					$result = $db->loadResultArray();
					if (is_array($result))
						$str_filter .= "&category=".implode(',',$result);	
				}				
				if (($row->filter_location_id!='')&&($row->filter_location_id!=null))
				{	
					$db = JFactory::getDBO();
					$query = "SELECT  name FROM #__ja_location WHERE id IN ($row->filter_location_id)";
					$db->setQuery($query);
					$result = $db->loadResultArray();
					if (is_array($result))
						$str_filter .= "&location=".implode(',',$result);	
					
				}
				if (($row->filter_zipcode!='')&&($row->filter_zipcode!=null))
					$str_filter .= "&zipcode=$row->filter_zipcode";
				if (($row->filter_date!='')&&($row->filter_date!=null))
					$str_filter .= "&effected_date=$row->filter_date";
				if ($row->filter_is_premium)
					$str_filter .= "&premium=1";
				if (($row->filter_exitems!='')&&($row->filter_exitems!=null))	
					$str_filter .= "&exitems=$row->filter_exitems";
				if (($row->filter_exemployers!='')&&($row->filter_exemployers!=null))	
					$str_filter .= "&exemployers=$row->filter_exemployers";
				if (($row->filter_inemployers!='')&&($row->filter_inemployers!=null))	
					$str_filter .= "&inemployers=$row->filter_inemployers";
                $feedurl = JRoute::_( JURI::root() . "index.php?option=com_jajobboard&view=jafeeds&layout=rss&cid[]=".$row->id."&alias=".$row->feed_alias.$str_filter);
                ?>
            <tr class="<?php echo "row$k"; ?>">
                <td><?php echo $this->pagination->getRowOffset( $i ); ?></td>
                <td>
                    <?php echo $checked ;?>
                </td>
                <td>

                    <span class="editlinktip hasTip" title="<?php echo JText::_( 'Edit feed' );?>::<?php echo $this->escape($row->feed_name); ?>">
                        <a href="<?php echo $feedurl ?>"  target="_blank">
                    <?php echo $this->escape($row->feed_name); ?></a></span>

                </td>
                <td><?php echo $row->feed_description; ?></td>
                <td><?php echo JText::_('Version').' '.$row->feed_type.' '; ?><img src="<?php if($row->feed_button != "") {echo (JURI::root() . "components/com_jajobboard/views/jafeeds/images/buttons/".$row->feed_button);} ?>"></td>
                <td><a href="<?php echo JRoute::_("index.php?option=com_jajobboard&view=jafeeds&task=edit&cid[]=$row->id"); ?>"><?php echo JText::_('Edit');?></a></td>
                <td><?php echo $published ;?></td>
            <?php		$k = 1 - $k; ?>		</tr>
            <?php	}
        ?>

        </table>
    </fieldset>
 	</div>
    <input type="hidden" name="option" value="com_jajobboard" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
    <input type="hidden" name="view" value="jafeeds" />
    <?php echo JHTML::_( 'form.token' ); ?>
</form>